﻿#ifndef TK_NET_H
#define TK_NET_H
#include <QtGlobal>

#include <boost/asio/socket_base.hpp>

typedef unsigned short int  uint16,u_short;
typedef unsigned long int   uint32,u_long;
typedef unsigned char       u_char;

struct _in_addr
{
    union
    {
        struct
        {
            u_char s_b1,s_b2,s_b3,s_b4;
        } S_un_b; //An IPv4 address formatted as four u_chars.
        struct
        {
            u_short s_w1,s_w2;
        } S_un_w; //An IPv4 address formatted as two u_shorts
       u_long S_addr;//An IPv4 address formatted as a u_long
    } S_un;
#define s_addr S_un.S_addr
};


// 模拟htonl函数，本机字节序转网络字节序
uint32 _htonl(uint32 h);

// 模拟ntohl函数，网络字节序转本机字节序
uint32 _ntohl(uint32 n);

// 模拟htons函数，本机字节序转网络字节序
uint16 _htons(uint16 h);

// 模拟ntohs函数，网络字节序转本机字节序
uint16 _ntohs(uint16 n);




#endif // TK_NET_H
